package com.example.day02.startfrag;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.day02.Custom.DLRoundImageView;
import com.example.day02.R;
import com.example.day02.utils.AssetsUtils;

import java.io.Serializable;
import java.util.List;

public class StarSignActivity extends AppCompatActivity implements View.OnClickListener {
    private static final String TAG = "StarSignActivity";
    ImageView backIv;
    StarInfo.StarinfoBean starinfoBean;
    List starLv;
    TextView sign_name,
    sign_data,
    sign_td,
    sign_gw,
    sign_yy,
    sign_tz,
    sign_zg,
    sign_ys,
    sign_zb,
    sign_hm,
    sign_js,
    sign_info,
    titleTv;
    String name;
   DLRoundImageView logoIv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_star_sign);

        //获取上一个界面传递过来的数据
        Intent intent = getIntent();
         starinfoBean = (StarInfo.StarinfoBean) intent.getSerializableExtra("starinfo");

        name = starinfoBean.getName();
        Log.d(TAG, "name: "+name);
        initView();
    }

    private void initView() {
        titleTv=findViewById(R.id.title_tv);
        titleTv.setText(name);
        backIv=findViewById(R.id.title_iv_back);
        logoIv=findViewById(R.id.star_sign_iv);
        String filename="xzcontentlogo/"+starinfoBean.getLogoname()+".png";;
        Bitmap bm = AssetsUtils.getBitmapByAssets(this, filename);
        logoIv.setImageBitmap(bm);
        sign_name=findViewById(R.id.sign_name);
        sign_name.setText(name);
        sign_data=findViewById(R.id.sign_data);
        String date = starinfoBean.getDate();
        sign_data.setText(date);
        sign_td=findViewById(R.id.sign_td);
        String td = starinfoBean.getTd();
        sign_td.setText(td);
        sign_gw=findViewById(R.id.sign_gw);
        String gw = starinfoBean.getGw();
        sign_gw.setText(gw);
        sign_yy=findViewById(R.id.sign_yy);
        String yy = starinfoBean.getYy();
        sign_yy.setText(yy);
        sign_tz=findViewById(R.id.sign_tz);
        sign_tz.setText(starinfoBean.getTz());
        sign_zg=findViewById(R.id.sign_zg);
        sign_zg.setText(starinfoBean.getZg());
        sign_ys=findViewById(R.id.sign_ys);
        sign_ys.setText(starinfoBean.getYs());
        sign_zb=findViewById(R.id.sign_zb);
        sign_zb.setText(starinfoBean.getZb());
        sign_hm=findViewById(R.id.sign_hm);
        sign_hm.setText(starinfoBean.getHm());
        sign_js=findViewById(R.id.sign_js);
        sign_js.setText(starinfoBean.getJs());
        sign_info=findViewById(R.id.sign_info);
        sign_info.setText(starinfoBean.getInfo());
        backIv.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.title_iv_back:
                finish();
                break;
        }
    }
}
